<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript">
	$(function() {
	
		$('#pid').combotree({
			url : '${ctx}/weiMenu/tree?flag=false',
			parentField : 'pid',
			lines : true,
			panelHeight : 'auto',
			value :'${weiMenu.pid}'
		});
		
		$('#weiMenuEditForm').form({
			url : '${ctx}/weiMenu/edit',
			onSubmit : function() {
				progressLoad();
				var isValid = $(this).form('validate');
				if (!isValid) {
					progressClose();
				}
				return isValid;
			},
			success : function(result) {
			
				progressClose();
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.openner_treeGrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为organization.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				} else {
					parent.$.messager.alert('错误', result.msg, 'error');
				}
			}
		});
		$("#menuType").val('${weiMenu.menuType}');
		if(${weiMenu.isEnable}){
			$("#isEnable").val(1);
		}else{
			$("#isEnable").val(0);
		}
		$("#note").val('${weiMenu.note}');
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
		<form id="weiMenuEditForm" method="post">
			<table class="grid">
           <input name="id" type="hidden"  value="${weiMenu.id}">
           		<tr>
					<td>上级部门</td>
						<td><select id="pid" name="pid" style="width:200px;height: 29px;"></select>
						<a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#pid').combotree('clear');" >清空</a>
					</td>
				</tr>
				<tr>
					<td>资源类型</td>
					<td><select id="menuType" name="menuType" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto'">
								<option value="0">菜单</option>
								<option value="1">按钮</option>
								<option value="2">页面</option>
					</select></td>
				</tr>
				<tr>
					<td>菜单名称</td>
					<td><input name="menuName" type="text" placeholder="请输入菜单名称" class="easyui-validatebox"  value="${weiMenu.menuName}"></td>
				</tr>
				<tr>
					<td>菜单事件</td>
					<td><input name="menuEvent" type="text" placeholder="请输入菜单事件" class="easyui-numberbox"  value="${weiMenu.menuEvent}"></td>
				</tr>
				<tr>
					<td>跳转地址</td>
					<td><input name="gotoUrl" type="text" placeholder="请输入跳转地址" class="easyui-validatebox"  value="${weiMenu.gotoUrl}"></td>
				</tr>
				<tr>
					<td>菜单类型</td>
					<td>
						<select id="isEnable" name="isEnable" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto'">
							<option value="1">是</option>
							<option value="0">否</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>菜单序号</td>
					<td><input name="menuSeq" type="text" placeholder="请输入菜单序号" class="easyui-numberspinner"  value="${weiMenu.menuSeq}"></td>
				</tr>
				<tr>
					<td>备注</td>
					<td><textarea  name="note" id="note" rows="" cols="" ></textarea></td>
				</tr>
			</table>
		</form>
	</div>
</div>
